﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrayParrot.Web.Formly
{
    /// <summary>
    /// Event callback definition...
    /// </summary>
    public class EventCallback
    {
        public object Callback { get; set; }
        public EventTypes Evento { get; set; }

        public EventCallback()
        {

        }
    }

    /// <summary>
    /// Event types...
    /// </summary>
    public enum EventTypes
    {
        OnChange = 0,
        OnKeydown,
        OnKeyup,
        OnKeypress,
        OnClick,
        OnFocus,
        OnBlur,
    }

    /// <summary>
    /// Attribute for the event definition... 
    /// </summary>
    /// <seealso cref="System.Attribute" />
    [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
    public class EventsAttribute : Attribute
    {
        /// <summary>
        /// Gets or sets the javascript callback for the event... 
        /// </summary>
        /// <value>
        /// The callback.
        /// </value>
        public string Callback { get; set; }

        /// <summary>
        /// Gets or sets the type of event
        /// </summary>
        /// <value>
        /// The evento.
        /// </value>
        public EventTypes Event { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="EventsAttribute"/> class.
        /// </summary>
        public EventsAttribute()
        {

        }
    }
}
